#ifndef SKETCHPADWIDGET_H
#define SKETCHPADWIDGET_H

#include <QWidget>
#include <QGLWidget>
#include <QMouseEvent>

#ifdef _WIN32
	#include <windows.h>
	#include <GL/gl.h>
	#include <GL/glu.h>
	#include "GLUT/glut.h"
#else
	#include <OpenGL/gl.h>
	#include <OpenGL/glu.h>
	#include <GLUT/glut.h>
#endif

#include "SketchModel.h"
#include "TreeRenderAgent.h"

using namespace std;

class SketchPadWidget : public QGLWidget
{
	Q_OBJECT

public:
	SketchPadWidget(QWidget *parent);
	~SketchPadWidget();

	// Initialises variables for a new user drawing
	void initSketchModel();

signals:
	void newSketchStarted(SketchModel *model);
	void sketchModelUpdated();

protected:
	SketchModel  *sketchModel;
	
	// Status variable - true if user is drawing a curve on the SketchPadWidget
	bool sketch_active;

	// Variables used for recording a new CSketch
	int numPixels;		// Number of pixels drawn so far
	int pixel[10000][2];// Coordinates of all pixels drawn
	int max_height;		// max_height of sketch
	int min_height;		// min height of sketch
	GLuint startTime;	// time stamp - can be used to group sketches
	GLuint sketchTime;	// time to draw sketch - can be used to classify sketch (e.g. scribbles are done quickly)

	void mouseMoveEvent(QMouseEvent *event);
	void mousePressEvent(QMouseEvent *event);
	void mouseReleaseEvent(QMouseEvent *event);

	void initializeGL();
	void paintGL();
	void resizeGL(int w, int h);
};

#endif // SKETCHPADWIDGET_H
